//index.js
//获取应用实例
var app = getApp()
Page({
  data: {
    userInfo:{},
    items:''
  },
  bindViewTap: function(e){
    wx.navigateTo({
      url: '../login/index'
    })
  },
  onLoad:function(){
    var openid = (wx.getStorageSync('openid'))  
    wx.setNavigationBarTitle({
      title: '我的',
    })
    app.getUserInfo((data) => {
      this.setData({
        userInfo:data
      })
    });
    // wx.request({
    //   url:'http://www.easy-mock.com/mock/5906811e7a878d73716e32c9/viplist/mylist',
    //   method:'GET',
    //   data:{},
    //   header:{
    //     'Accept':'application/json'
    //   },
    //   success:(res) => {
    //     console.log(res);
    //     this.setData({
    //       items:res.data.item
    //     })
    //   }
    // })
    var that = this;
    wx.request({
      url: app.globalData.serviceUrl + '/api/User/getUserInfo',
      method: "POST",
      dataType: "json",
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      data: { "openid": openid},
      success: function(res){
        console.log(res);
        that.setData({
          items: res.data.data
        });
      }
    })
  },
  phoneCall: function () {
    wx.makePhoneCall({
      phoneNumber: '123456',
    })
  },
  nav_jump:function(e){
    //console.log(e.currentTarget.dataset.jumpname);
    var nav_url = e.currentTarget.dataset.jumpname;
    wx.navigateTo({
      url: '../'+nav_url+'/index',
    })
  }
})
